// pages/userCommunity/userCommunity.js
import { proxy } from '../../utils/util.js';
import LoginStore from '../login/store.js';
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '', //导航栏 中间的标题
      background: 'linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0))',
      hasFilter: true,
      color: '#FFFFFF',
      btnStyle: 'white', //black, white
    },
    navBarHeight: app.globalData.height,
    params: {},
    urlStr: '',
    userId: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      userId: options.userId,
      params: {
        orderBy: 'score',
        imgsize: 'p1,p2,p3',
        queryId: options.userId,
        page: 1,
        size: 4,
        type: 'json'
      },
      urlStr: `${proxy}/community/tribe/myTribes`
    })
  },

  
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    let params = this.data.params;
    params.page++;
    this.setData({
      params: params
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  refreshList: function () {
    this.setData({
      params: {
        orderBy: 'score',
        imgsize: 'p1,p2,p3',
        queryId: this.data.userId,
        page: 1,
        size: 4,
        type: 'json'
      },
    })
  }
})